package myFunc

import (
	"errors"
	"fmt"
	"testing"
)

func Add(x, y int) int {
	return x + y
}

// 用于测试用例的测试
func SayHello(flag int) error {
	x := Add(1, 2)
	fmt.Println("x: ", x)
	fmt.Println("Hello World")

	if flag == 0 {
		return errors.New("flag 'peer.address' must be set")
	}

	return nil
}

// SayGoodbye 打印两行字符串
func SayGoodbye() int {
	fmt.Println("Hello,")
	fmt.Println("goodbye")
	return 0
}

// PrintNames 打印学生姓名
func PrintNames(t *testing.T) int {
	students := make(map[int]string, 4)
	students[1] = "Jim"
	students[2] = "Bob"
	students[3] = "Tom"
	students[4] = "Sue"
	for _, value := range students {
		fmt.Println(value)
	}
	return 0
}
